package com.feicheng.lanniao.service.impl.selectRecord;

import com.feicheng.lanniao.exception.SystemException;
import com.feicheng.lanniao.mapper.selectRecord.SelectRecordMapper;
import com.feicheng.lanniao.service.selectRecord.SelectRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class SelectRecordServiceImpl implements SelectRecordService {

    @Autowired
    private SelectRecordMapper selectRecordMapper;

    // Car_Buy_Info的查询记录=============================================================================================
    //====================================================================================================================
    /**
     * @param CbId CarBuyId
     * @param ClientId 用户Id
     * @description 插入一条用户查询记录,关联买车
     * @return
     */
    @Override
    public void insertSelectRecord(Integer CbId, Integer ClientId) {
        log.info("SelectRecordServiceImpl的insertSelectRecord方法进入,参数CbId为+"+CbId+",参数ClientId为"+ClientId);
        Integer insertCount = selectRecordMapper.insertSelectRecord(CbId, ClientId);
        if(insertCount != 1){
            throw new SystemException("插入查询记录失败");
        }
    }


    /**
     * @param CbId CarBuyId
     * @param ClientId 用户Id
     * @description 查询这名用户是否已经查询了这条信息
     * @return
     */
    @Override
    public Integer selectCountOfSelect(Integer CbId, Integer ClientId) {
        log.info("SelectRecordServiceImpl的selectCountOfSelect方法进入,参数CbId为+"+CbId+",参数ClientId为"+ClientId);
        Integer selectCount = selectRecordMapper.selectCountOfSelect(CbId, ClientId);
        return selectCount;
    }



    // Car_Rent_Info的查询记录=============================================================================================
    //====================================================================================================================
    /**
     * @param carRentId 求租车发布信息Id
     * @param clientId 用户Id
     * @description 插入一条用户查询记录,关联求租车
     * @return
     */
    @Override
    public void insertSelectCarRentRecord(Integer carRentId, Integer clientId) {
        log.info("SelectRecordServiceImpl的insertSelectCarRentRecord方法进入,参数carRentId为"+carRentId+",参数clientId为"+clientId);
        Integer insertCount = selectRecordMapper.insertSelectCarRentRecord(carRentId, clientId);
        if(insertCount != 1){
            throw new SystemException("插入查询记录失败");
        }
    }

    /**
     * @param carRentId CarRentId
     * @param clientId 用户Id
     * @description 查询这名用户是否已经查询了这条信息,关联求租车
     * @return
     */
    @Override
    public Integer selectCountOfSelectCarRentRecord(Integer carRentId, Integer clientId) {
        log.info("SelectRecordServiceImpl的selectCountOfSelectCarRentRecord方法进入,参数carRentId为"+carRentId+",参数clientId为"+clientId);
        Integer selectCount = selectRecordMapper.selectCountOfSelectCarRentRecord(carRentId, clientId);
        return selectCount;
    }


    // Car_Rental_Info的查询记录=========================================================================================
    //====================================================================================================================
    /**
     * @param carRentalId 承租车发布信息Id
     * @param clientId 用户Id
     * @description 插入一条用户查询记录,关联承租车
     * @return
     */
    @Override
    public void insertSelectCarRentalInfo(Integer carRentalId, Integer clientId) {
        log.info("SelectRecordServiceImpl的insertSelectCarRentalInfo方法进入,参数carRentalId为"+carRentalId+",参数clientId为"+clientId);
        Integer insertCount = selectRecordMapper.insertSelectCarRentalInfo(carRentalId, clientId);
        if(insertCount != 1){
            throw new SystemException("插入查询记录失败");
        }
    }

    /**
     * @param carRentalId carRentalId
     * @param clientId 用户Id
     * @description 查询这名用户是否已经查询了这条信息,关联承租车
     * @return
     */
    @Override
    public Integer selectCountOfSelectCarRentalRecord(Integer carRentalId, Integer clientId) {
       log.info("SelectRecordServiceImpl的selectCountOfSelectCarRentalRecord方法进入,参数carRentalId为"+carRentalId+",参数clientId为"+clientId);
        Integer selectCount = selectRecordMapper.selectCountOfSelectCarRentalRecord(carRentalId, clientId);
        return selectCount;
    }


    //Car_Sell_Info的查询记录=============================================================================================
    //====================================================================================================================
    /**
     * @param carSellId 卖租车发布信息Id
     * @param clientId 用户Id
     * @description 插入一条用户查询记录,关联卖车
     * @return
     */
    @Override
    public void insertSelectCarSellInfo(Integer carSellId, Integer clientId) {
        log.info("SelectRecordServiceImpl的insertSelectCarSellInfo的方法进入,参数carSellId为"+carSellId+",参数clientId为"+clientId);
        Integer insertCount = selectRecordMapper.insertSelectCarSellInfo(carSellId, clientId);
        if(insertCount != 1){
            throw new SystemException("插入查询记录失败");
        }
    }

    /**
     * @param carSellId carSellId
     * @param clientId 用户Id
     * @description 查询这名用户是否已经查询了这条信息,关联卖车
     * @return
     */
    @Override
    public Integer selectCountOfSelectCarSellRecord(Integer carSellId, Integer clientId) {
        log.info("SelectRecordServiceImpl的selectCountOfSelectCarSellRecord的方法进入,参数carSellId为"+carSellId+",参数clientId为"+clientId);
        Integer selectCount = selectRecordMapper.selectCountOfSelectCarSellRecord(carSellId, clientId);
        return selectCount;
    }


    //House_Buy_Info的查询记录==========================================================================================
    //====================================================================================================================
    /**
     * @param houseBuyId 买房发布信息Id
     * @param clientId 用户Id
     * @description 插入一条用户查询记录,关联买房
     * @return
     */
    @Override
    public void insertSelectHouseBuyInfo(Integer houseBuyId, Integer clientId) {
        log.info("SelectRecordServiceImpl的insertSelectHouseBuyInfo方法进入,参数CbId为+"+houseBuyId+",参数ClientId为"+clientId);
        Integer insertCount = selectRecordMapper.insertSelectHouseBuyInfo(houseBuyId, clientId);
        if(insertCount != 1){
            throw new SystemException("插入查询记录失败");
        }
    }

    /**
     * @param houseBuyId houseBuyId
     * @param clientId 用户Id
     * @description 查询这名用户是否已经查询了这条信息,关联买房
     * @return
     */
    @Override
    public Integer selectCountOfSelectHouseBuyInfo(Integer houseBuyId, Integer clientId) {
        log.info("SelectRecordServiceImpl的selectCountOfSelectHouseBuyInfo方法进入,参数CbId为+"+houseBuyId+",参数ClientId为"+clientId);
        Integer selectCount = selectRecordMapper.selectCountOfSelectHouseBuyInfo(houseBuyId, clientId);
        return selectCount;
    }

    //House_Lease_Info的查询记录=======================================================================================
    //====================================================================================================================
    /**
     * @param houseLeaseId 承租房发布信息Id
     * @param clientId 用户Id
     * @description 插入一条用户查询记录,关联承租房
     * @return
     */
    @Override
    public void insertSelectHouseLeaseInfo(Integer houseLeaseId, Integer clientId) {
        log.info("SelectRecordServiceImpl的insertSelectHouseLeaseInfo方法进入,参数CbId为+"+houseLeaseId+",参数ClientId为"+clientId);
        Integer insertCount = selectRecordMapper.insertSelectHouseLeaseInfo(houseLeaseId, clientId);
        if(insertCount != 1){
            throw new SystemException("插入查询信息失败");
        }
    }

    /**
     * @param houseLeaseId houseLeaseId
     * @param clientId 用户Id
     * @description 查询这名用户是否已经查询了这条信息,关联买承租房
     * @return
     */
    @Override
    public Integer selectCountOfSelectHouseLeaseInfo(Integer houseLeaseId, Integer clientId) {
       log.info("SelectRecordServiceImpl的selectCountOfSelectHouseLeaseInfo方法进入,参数houseLeaseId为"
               +houseLeaseId,"参数clientId为"+clientId);
        Integer selectCount = selectRecordMapper.selectCountOfSelectHouseLeaseInfo(houseLeaseId, clientId);
        return selectCount;
    }

    //House_Rent_Info的查询记录=========================================================================================
    //====================================================================================================================
    /**
     * @param houseRentId 求租房发布信息Id
     * @param clientId 用户Id
     * @description 插入一条用户查询记录,关联求租房
     * @return
     */
    @Override
    public void insertSelectHouseRentInfo(Integer houseRentId, Integer clientId) {
        log.info("SelectRecordServiceImpl的insertSelectHouseRentInfo方法进入,参数houseRentId为"+houseRentId+",参数clientId为"+
                clientId);
        Integer insertCount = selectRecordMapper.insertSelectHouseRentInfo(houseRentId, clientId);
        if(insertCount != 1){
            throw new SystemException("插入查询信息失败");
        }
    }

    /**
     * @param houseRentId houseRentId
     * @param clientId 用户Id
     * @description 查询这名用户是否已经查询了这条信息,关联求租房
     * @return
     */
    @Override
    public Integer selectCountOfSelectHouseRentInfo(Integer houseRentId, Integer clientId) {
        log.info("SelectRecordServiceImpl的selectCountOfSelectHouseRentInfo方法进入,参数houseRentId为"+houseRentId+",参数clientId为"+
                clientId);
        Integer selectCount = selectRecordMapper.selectCountOfSelectHouseRentInfo(houseRentId,clientId);
        return selectCount;
    }


    //House_Sell_Info的查询记==========================================================================================
    //====================================================================================================================
    /**
     * @param houseSellId 卖房发布信息Id
     * @param clientId 用户Id
     * @description 插入一条用户查询记录,关联卖房
     * @return
     */
    @Override
    public void insertSelectHouseSellInfo(Integer houseSellId, Integer clientId) {
        log.info("SelectRecordServiceImpl的insertSelectHouseSellInfo方法进入,参数houseSellId为"+houseSellId+",参数clientId"+clientId);
        Integer insertCount = selectRecordMapper.insertSelectHouseSellInfo(houseSellId, clientId);
        if(insertCount != 1){
            throw new SystemException("插入查询信息失败");
        }
    }

    /**
     * @param houseSellId houseSellId
     * @param clientId 用户Id
     * @description 查询这名用户是否已经查询了这条信息,关联卖房
     * @return
     */
    @Override
    public Integer selectCountOfSelectHouseSellInfo(Integer houseSellId, Integer clientId) {
       log.info("SelectRecordServiceImpl的selectCountOfSelectHouseSellInfo方法进入,参数houseSellId为"+houseSellId,"参数clientId为"+clientId);
        Integer selectCount = selectRecordMapper.selectCountOfSelectHouseSellInfo(houseSellId, clientId);
        return selectCount;
    }

}
